package com.baizhi.vo;

import java.util.HashMap;

/**
 * @author yu
 */
public class R extends HashMap<String,Object> {
    public R() {
        put("code",100);
        put("msg","成功");
    }
    public R(Integer code,String msg){
        put("code",code);
        put("msg",msg);
    }
    public R(String msg){
        this();
        put("msg",msg);
    }
    public static R ok(){
        return new R();
    }
    public static R ok(String msg){
        return new R(msg);
    }
    public static R ok(Integer code,String msg){
        return new R(code,msg);
    }
    public static R error(){
        return new R(500,"未知错误");
    }
    public static R error(Integer code,String msg){
        return new R(code,msg);
    }

    public R put(String key,Object value){
        super.put(key,value);
        return this;
    }
}
